$.fn.serializeObject = function()    
{    
   var o = {};    
   var a = this.serializeArray();    
   $.each(a, function() {    
       if (o[this.name]) {    
           if (!o[this.name].push) {    
               o[this.name] = [o[this.name]];    
           }    
           o[this.name].push(this.value || '');    
       } else {    
           o[this.name] = this.value || '';    
       }    
   });    
   return o;    
};  

function isNull(data){  
	return (data == "" || data == undefined || data == null) ? true : false;  
}
function showJson(obj){
	   var jStr = "{ ";
	    for(var item in obj){
	        jStr += "'"+item+"':'"+obj[item]+"',";
	    }
	    jStr += " }";
	    alert(jStr);
	    return jStr;
}

function pageFoot(curPage,total,pageSize){
    var totalPages = Math.ceil(total / pageSize);
     
    var html = '<div class="ui-paging"><span class="ui-paging-info">第<span class="ui-paging-bold">'+curPage+'/'+totalPages+'</span>页</span> ';
    if(curPage == 1){
        html+='<span class="ui-paging-prev"><i class="iconfont">&#xF039;</i> 上一页 </span>';
    }else{
        var prePage = curPage - 1;
        html+='<a href="javascript:void(0);" onclick="show('+prePage+')"  class="ui-paging-prev"><i class="iconfont">&#xF039;</i> 上一页 </span>';
    }
    
    if(curPage == total){
        html+=' <span class="ui-paging-next"> 下一页 <i class="iconfont">&#xF03A;</i></span>';
    }else{
        var nextPage = curPage + 1;
        html+='<a href="javascript:void(0);" onclick="show('+nextPage+')"  class="ui-paging-next">下一页 <i class="iconfont">&#xF03A;</i></a>';
    }
    html +='</div>'; 
    return html;
}



function imgShow(outerdiv, innerdiv, bigimg, _this){
	var src = _this.data("src");
	$(bigimg).attr("src", src);
	$("<img/>").attr("src", src).load(function(){
		var windowW = $(window).width();
		var windowH = $(window).height(); 
		var imgWidth=this.width,imgHeight=this.height;
		var wRate = 1,hRate=1,rate;
		if(imgWidth>windowW)wRate=windowW/imgWidth;
		if(imgHeight>windowH)hRate=windowH/imgHeight;
		if(wRate > hRate){
			rate=hRate;
		}else{
			rate=wRate;
		}
		var imgW = imgWidth*rate,imgH=imgHeight*rate;
		$(bigimg).css("width",imgW);
		$(bigimg).css("height",imgH);
		$(bigimg).css("max-width",windowW);
		$(bigimg).css("max-height",windowH);
		
		
		var w = (windowW-imgW)/2;
		var h = (windowH-imgH)/2;
		if(h<0)h=0;
		if(w<0)w=0;
		$(innerdiv).css({"top":h, "left":w});
		$(outerdiv).fadeIn("fast");
	});
	$(outerdiv).click(function(){
		$(this).fadeOut("fast");
	});
} 